#ifndef JSON_H
#define JSON_H 

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>


#include "tools/log_util.h"

typedef enum {
    JSON_NULL,
    JSON_BOOL,
    JSON_NUMBER,
    JSON_STRING,
    JSON_ARRAY,
    JSON_OBJECT
} JsonType;

typedef struct JsonValue JsonValue;
typedef struct JsonMember JsonMember;

 struct JsonMember {
    char *key;
    JsonValue *value;
};

 struct JsonValue {
    JsonType type;
    union {
        int boolean;
        double number;
        char *string;
        struct {
            JsonValue **elements;
            size_t count;
            size_t capacity;
        } array;
        struct {
            JsonMember *members;
            size_t count;
            size_t capacity;
        } object;
    } value;
};

 JsonValue *parse_value(const char **str);

#endif